import 'package:flutter/material.dart';
import 'package:hbtrans_flutter/apis.dart';
import 'package:hbtrans_flutter/beans/signuporder_bean.dart';
import 'package:hbtrans_flutter/const.dart';
import 'package:hbtrans_flutter/utils/mydio.dart';
class OrderDetail extends StatefulWidget {
  @override
  _OrderDetailState createState() => _OrderDetailState();
}

class _OrderDetailState extends State<OrderDetail> {

  Widget itemList(){
    return Container(
        child: GestureDetector(
          onTap: (){

          },
          child: Row(
            children: <Widget>[
              Icon(Icons.photo,size: 75,),
              SizedBox(width: 12,),
              Expanded(child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                children: <Widget>[
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      Text('保定运通驾校-VIP班',style: TextStyle(fontSize:13,color: Color(0xff666666) ),),
                      Text('¥299.0',style: TextStyle(fontSize:13,color: Color(0xff666666) ),)
                    ],
                  ),
                  SizedBox(height: 3,),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      Text('标准',style: TextStyle(fontSize:13,color: Color(0xff666666) ),),
                      Text('X1',style: TextStyle(fontSize:13,color: Color(0xff666666) ),)
                    ],
                  ),
                  SizedBox(height: 4,),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Container(
                        padding: EdgeInsets.fromLTRB(5, 2, 5, 2),
                        decoration: BoxDecoration(
                          color: Color(0xffF44336),
                          borderRadius: BorderRadius.circular(15.0),),
                        child: Text('七天无理由退换',style: TextStyle(fontSize: 10,color: Colors.white),),
                      )
                    ],
                  )

                ],
              ))

            ],
          ),
        )
    );
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    signuporder('');
  }

  void signuporder(String id) async {
    MyDio.getInstance(url: Const.TRANS_SERVER_PATH_NEW3).get('${Apis.signUpOrder}$id', (data) {
      print(data);
//      if (loadingDialog != null) {
//        loadingDialog = null;
//        Navigator.pop(context);
//      }
      SignUpOrderBean signUpOrderBean = SignUpOrderBean.fromJson(data);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('我的订单'),
          centerTitle: true,
          backgroundColor: Color(0xff23AFDC),
        ),
        body: ListView(
          children: <Widget>[
            Padding(
              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
              child:Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text('订单编号:',style: TextStyle(fontSize: 13,color: Color(0xff333333)),),
                  Text('20191241512554',style: TextStyle(fontSize: 13,color: Color(0xff999999)),),
                ],
              ) ,
            ),
            Container(
                height: 1,
              color: Color(0xffEBEBEB),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
              child:Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text('订单时间:',style: TextStyle(fontSize: 13,color: Color(0xff333333)),),
                  Text('2019-10-24 09:10:10',style: TextStyle(fontSize: 13,color: Color(0xff999999)),),
                ],
              ) ,
            ),
            Container(
              height: 1,
              color: Color(0xffEBEBEB),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
              child:Row(
                mainAxisAlignment: MainAxisAlignment.start,
                children: <Widget>[
                  Text('商品信息',style: TextStyle(fontSize: 13,color: Color(0xff333333),),),
                ],
              )

            ),
            Container(
              height: 1,
              color: Color(0xffEBEBEB),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
              child:ListView.builder(
                  shrinkWrap: true,
                  itemCount: 1,
                  physics: NeverScrollableScrollPhysics(),
                  itemBuilder: (BuildContext context,int index){
                    return itemList();
                  }
              ),
            ),
            Container(
              height: 1,
              color: Color(0xffEBEBEB),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
              child: Column(
                children: <Widget>[
                  Row(
                    children: <Widget>[
                      Text('李',style: TextStyle(fontSize: 14,color: Color(0xff666666)),),
                      SizedBox(width: 12,),
                      Text('15131660632',style: TextStyle(fontSize: 14,color: Color(0xff666666)),),
                    ],
                  ),
                  SizedBox(height: 10,),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      Text('北京市北京城区东城区地址',style: TextStyle(fontSize: 14,color: Color(0xff666666)),),
                    ],
                  )
                ],
              ),
            ),
            Container(
              height: 1,
              color: Color(0xffEBEBEB),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
              child:Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text('商品合计:',style: TextStyle(fontSize: 13,color: Color(0xff333333)),),
                  Text('￥299.0',style: TextStyle(fontSize: 13,color: Color(0xff999999)),),
                ],
              ) ,
            ),
            Container(
              height: 1,
              color: Color(0xffEBEBEB),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
              child:Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text('运费:',style: TextStyle(fontSize: 13,color: Color(0xff333333)),),
                  Text('￥0.0',style: TextStyle(fontSize: 13,color: Color(0xff999999)),),
                ],
              ) ,
            ),
            Container(
              height: 1,
              color: Color(0xffEBEBEB),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
              child:Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text('优惠:',style: TextStyle(fontSize: 13,color: Color(0xff333333)),),
                  Text('￥0.0',style: TextStyle(fontSize: 13,color: Color(0xff999999)),),
                ],
              ) ,
            ),
            Container(
              height: 1,
              color: Color(0xffEBEBEB),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
              child:Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text('实付:',style: TextStyle(fontSize: 13,color: Color(0xff333333)),),
                  Text('¥299.0',style: TextStyle(fontSize: 13,color: Color(0xff999999)),),
                ],
              ) ,
            ),
            Container(
              height: 1,
              color: Color(0xffEBEBEB),
            ),
            SizedBox(height: 15,),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 13),
              child: Row(
                children: <Widget>[
                  Expanded(
                    flex: 1,
                    child: Container(
                      height: 40,
                      alignment:Alignment.center,
                      decoration: BoxDecoration(
                        color: Color(0xffF44336),
                        borderRadius: BorderRadius.circular(5.0),),
                      child: Text('取消',style: TextStyle(fontSize: 14,color: Colors.white),),
                    ),
                  ),
                  SizedBox(width: 29,),
                  Expanded(
                    flex: 1,
                    child: Container(
                      alignment:Alignment.center,
                      decoration: BoxDecoration(
                        color: Color(0xffF44336),
                        borderRadius: BorderRadius.circular(5.0),),
                      height: 40,
                      child: Text('删除',style: TextStyle(fontSize: 14,color: Colors.white),),
                    ),
                  ),
                ],
              ),
            ),
            SizedBox(height: 37,),
          ],
        ),
      );

  }
}
